<template>
  <el-pagination v-model:current-page="props.page" v-model:page-size="props.pageSize" :total="props.total"
    :page-sizes="[5, 10]" layout="total, sizes, prev, pager, next, jumper" background @size-change="onSizeChange"
    @current-change="onCurrentChange" class="pagination" />
</template>
<script setup lang="ts">
import { ElPagination } from 'element-plus';
const props = defineProps(["page", "pageSize", "total"]);
const emit = defineEmits(["onPageChange", "onSizeChange"]);
//当每页条数发生了变化，调用此函数
const onSizeChange = (num: number) => {
  emit("onSizeChange", num);
};
//当前页码发生变化，调用此函数
const onCurrentChange = (num: number) => {
  emit("onPageChange", num);
};
</script>
<style scoped lang="scss">
.pagination {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
</style>
